﻿<%@ Page Title="Register" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Register.aspx.cs" Inherits="HardwareAs.Account.Register" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>

    <asp:Panel ID="Panel1" runat="server">
                  <span class="failureNotification">
                        <asp:Literal ID="ErrorMessage" runat="server"></asp:Literal>
                    
                    </span>
                    <asp:ValidationSummary ID="RegisterUserValidationSummary" runat="server" CssClass="failureNotification" 
                         ValidationGroup="RegisterUserValidationGroup"/>
                <div class="accountInfo">
                        <fieldset class="register">
                            <legend>Register Form</legend>
                            <p>
                                <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="FirstName">FirstName:</asp:Label>
                                <asp:TextBox ID="FirstName" runat="server" CssClass="textEntry"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="FirstName" 
                                     CssClass="failureNotification" ErrorMessage="FirstName must be filled" ToolTip="FirstName must be filled" 
                                     ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator> 
                            </p>
                            <p>
                                <asp:Label ID="Label1" runat="server" AssociatedControlID="LastName">LastName:</asp:Label>
                                <asp:TextBox ID="LastName" runat="server" CssClass="textEntry"></asp:TextBox>
                                 <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="LastName" 
                                     CssClass="failureNotification" ErrorMessage="LastName must be filled" ToolTip="LastName must be filled" 
                                     ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator> 
                              </p>

                            <p>
                                <asp:Label ID="EmailLabel" runat="server" AssociatedControlID="Email">Email:</asp:Label>
                                <asp:TextBox ID="Email" runat="server" CssClass="textEntry"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="EmailRequired" runat="server" ControlToValidate="Email" 
                                     CssClass="failureNotification" ErrorMessage="Email must be filled" ToolTip="Email must be filled" 
                                     ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>  
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                                     ErrorMessage="Email must be a proper Format" ControlToValidate="Email" 
                                     CssClass="failureNotification" ToolTip="Email must be a proper Format"
                                     ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" 
                                     ValidationGroup="RegisterUserValidationGroup" >*</asp:RegularExpressionValidator>
                                <asp:CustomValidator ID="CustomValidator1" runat="server" 
                                    CssClass="failureNotification" ErrorMessage="This Email exist!" 
                                    onservervalidate="CustomValidator1_ServerValidate" 
                                    ValidationGroup="RegisterUserValidationGroup">*</asp:CustomValidator>
                            </p>
                             <p>
                               
                                <asp:Label ID="Label2" runat="server" AssociatedControlID="Address">Address:</asp:Label>
                                <asp:TextBox ID="Address" runat="server" CssClass="textEntry"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="Address" 
                                     CssClass="failureNotification" ErrorMessage="Address must be filled" ToolTip="Address must be filled" 
                                     ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
                            </p>
                             <p>
                                <asp:Label ID="Label3" runat="server" AssociatedControlID="LastName">Age:</asp:Label>
                                <asp:TextBox ID="Age" runat="server" CssClass="textEntry"></asp:TextBox>
                                <asp:RangeValidator ID="RangeValidator1" runat="server" 
                      ControlToValidate="Age" CssClass="failureNotification" 
                      ErrorMessage="Age must be a number and between 18 and 90" MaximumValue="90" 
                      MinimumValue="18" ValidationGroup="RegisterUserValidationGroup">*</asp:RangeValidator>
                       <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="Age" 
                                     CssClass="failureNotification" ErrorMessage="Age must be filled" ToolTip="Age must be filled" 
                                     ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator> 
                            </p>
                            <p>
                                <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
                               <asp:TextBox ID="Password" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
                                 <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                                    CssClass="failureNotification" ErrorMessage="Password must be 6-8 characters long and can only contain numbers and alphabets" 
                                    ValidationExpression="^(?![^a-zA-Z]+$)(?!\D+$).{8,15}$" 
                                    ValidationGroup="RegisterUserValidationGroup" ControlToValidate="Password">*</asp:RegularExpressionValidator>
                              <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="Password" 
                                     CssClass="failureNotification" ErrorMessage="Password must be filled" ToolTip="Password must be filled" 
                                     ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
                            </p>
                            <p>
                                <asp:Label ID="ConfirmPasswordLabel" runat="server" AssociatedControlID="ConfirmPassword">Confirm Password:</asp:Label>
                                <asp:TextBox ID="ConfirmPassword" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
                                     <asp:CompareValidator ID="PasswordCompare" runat="server" ControlToCompare="Password" ControlToValidate="ConfirmPassword" 
                                     CssClass="failureNotification" Display="Dynamic" ErrorMessage="Password and confirm Password must be same"
                                     ValidationGroup="RegisterUserValidationGroup">*</asp:CompareValidator>
                            </p>
                        </fieldset>
                        <p class="submitButton">
                            <asp:Button ID="CreateUserButton" runat="server" CommandName="MoveNext" Text="Register" 
                                 ValidationGroup="RegisterUserValidationGroup" 
                                onclick="CreateUserButton_Click"/>
                        </p>
                    </div>

    </asp:Panel>
    <asp:Panel ID="Panel2" runat="server" Visible="false" >
        <asp:Label ID="Label4" runat="server" Text="Register Successful!!"></asp:Label>
    </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
